import React, { PureComponent } from 'react';
import { Card, WingBlank, WhiteSpace, Accordion, List } from 'antd-mobile';
import { connect } from 'dva';
import ast from './index.less';
import md5 from 'md5';
import { createForm, formShape } from 'rc-form';
import { Divider } from 'antd';
const PlaceHolder = ({ className = '', ...restProps }) => (
  <div className={`${className} placeholder`} {...restProps}>Block</div>
);

class Culture extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }
  componentWillMount() {
    this.props.dispatch({ type: "trainingProgramModule/getTrainingProgramInfo" })
  }
  // 
  render() {
    return (
      <div>
        {this.props.list == "" ? null : <WingBlank size="lg">
          <WhiteSpace size="lg" />
          <Card>
            <Card.Header
              title={`培养方案`}
              thumb="https://gw.alipayobjects.com/zos/rmsportal/MRhHctKOineMbKAZslML.jpg"
              extra={<span>{`总分：${this.props.list.totalCredit}`}</span>}
            />
            <Card.Body>
              <div>{
                <div>
                  <p style={{ fontSize: "1rem", lineHeight: "1.5rem" }}>{this.props.list.schemeName}</p>
                  <Accordion style={{ marginTop: "1rem" }} className="my-accordion" onChange={this.onChange}>
                    {this.props.course.length == 0 ? null :
                      this.props.course.map(s => {
                        return (<Accordion.Panel key={s.courseName} header={s.courseName}>
                          <List className="my-list">
                            <List.Item>{`学分：${s.credit}`}</List.Item>
                            <List.Item>{`学时：${s.courseHour}`}</List.Item>
                            <List.Item>{`课程编号：${s.courseNum}`}</List.Item>
                            <List.Item>{`开课学期：${s.termIndex}`}</List.Item>
                            <List.Item>{`课程性质：${s.isDegree}`}</List.Item>
                            <List.Item>{`课程属性：${s.coursePropertyCode}`}</List.Item>
                            <List.Item>{`课程类别：${s.courseTypeCode}`}</List.Item>
                          </List>
                        </Accordion.Panel>)
                      })
                    }
                  </Accordion>
                </div>
              }</div>
            </Card.Body>
            <Card.Footer content=" " extra={<div> </div>} />
          </Card>
          <WhiteSpace size="lg" />
        </WingBlank>}
      </div>
    );
  }
}
function mapStateToProps(state) {
  return {
    list: state.trainingProgramModule.list,
    course: state.trainingProgramModule.course
  }
}
export default connect(mapStateToProps)(Culture);
